home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / CMATHW16.ZIP / DOC.ZIP / CDEMO.CPP next >
Encoding:
C/C++ Source or Header  |  1998-10-21  |  1.9 KB  |  43 lines

  1. /*************************   CDEMO.CPP   *********************************
  2. *                                                                        *
  3. *                Simple Demo Program for                                 *
  4. *                       C M A T H                                        *
  5. *                    for Borland C++                                     *
  6. *                                                                        *
  7. *       Copyright 1996-1998 by Martin Sander                             *
  8. *                                                                        *
  9. *       This sample program provides a very basic test                   *
  10. *       for the correct installation of CMATH.                           *
  11. *                                                                        *
  12. **************************************************************************/
  13.  
  14. /*  The include-file search path must contain
  15.     \bc\include; \bc\cmath\include;
  16.     The library search path must contain
  17.     \bc\lib; bc\cmath\lib;
  18.     You must build a project with the following entries:
  19.     \bc\cmath\cdemo.cpp
  20.     \bc\cmath\lib\CMATHL3.LIB (DOS),
  21.                or CMATHL3W.LIB (Windows 3.x, EasyWin),
  22.                or CMATHF3W.LIB (Win32, console model)
  23.     (If your Borland C++ directory has a name other than "bc",
  24.      or if you chose to install CMATH into a directory different
  25.      from "bc\cmath", you must use that other name, of course)
  26.     Additionally, you have to link in the standard run-time libraries
  27.     (BC++ 3.x:      use Options/Linker/Libraries;
  28.      BC++ 4.x, 5.x: use TargetExpert)
  29. */
  30.  
  31. #include <newcplx.h>
  32. #include <stdio.h>
  33.  
  34. NEWMATHERR
  35. int main( void )
  36. {
  37.     fComplex x, y;
  38.     x = sin( fComplex( 3, 5));
  39.     y = inv( fComplex(0,0));  // will produce an error message
  40.     printf( "x: {%f, %f}\n"
  41.             "y: {%g, %g}\n", x.Re, x.Im, y.Re, y.Im );
  42.     return 0;
  43. }